package com.myz.rabbitmq.consumer;

import com.myz.rabbitmq.config.ConfirmConfig;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

// 接受消息
@Slf4j
@Component
public class ConfirmConsumer {
    // 监听消息
    @RabbitListener(queues = ConfirmConfig.CONFIRM_QUEUE)
    public void confirmMsgReceive(Message message){
        String msg = new String(message.getBody());
        log.info("消费者接收到消息:{}",msg);
    }
}
